﻿package com.adsame.core
{
	import com.adsame.interfaces.*;
	import com.adsame.utils.*;

	/**
	 * AsamControllor 
	 * 
	 * @uses IAsamControllor
	 * @package 
	 * @version $id$
	 * @copyright Powered By Adsame 2008-2009 (c)
	 * @author olga 
	 * @license 
	 */
	public class AsamControllor implements IAsamControllor
	{
		protected var __view_map : XML;

		protected var __default_config : Object;

		protected var __views : IAsamIterator = new AsamIterator();


		/**
		 * _getParamValue 
		 * 
		 * @param name : String $name : String 
		 * @param params : IAsamParams $params : IAsamParams 
		 * @access protected
		 * @return void
		 */
		protected function _getParamValue(name : String, params : IAsamParams) : String
		{
			var reval : String = params.getParamValue(name);
			return reval ? reval : this.__default_config[name];
		}

		/**
		 * setParams 
		 * 
		 * @param params : IAsamParams $params : IAsamParams 
		 * @access public
		 * @return void
		 */
		public function setParams(params : IAsamParams) : void
		{
			/* it's a visual function, 
			   all the operation will be defined in subclass. */
		}

		/**
		 * render 
		 * 
		 * @param sence : IAsamSence $sence : IAsamSence 
		 * @access public
		 * @return void
		 */
		public function render(sence : IAsamSence) : void
		{
			var views : IAsamIterator = AsamViewManager.buildViewMap(this.__view_map);
			views.each(function(view) {
				this.__views.add(view, view.getName());
			}, this);
		}

		public function show() : void
		{
		}
	}
}
